﻿@model IEnumerable<Shop.Models.Product>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<table>
    <tr>
        <th>
            Price
        </th>
        <th>
            Name
        </th>
        <th>
            Description
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>

        @if (User.Identity.IsAuthenticated)
        {
            using (Html.BeginForm("AddNewProduct", "Orders", FormMethod.Post))
            {
                <input class="IdProduct" name="IdProduct" type="hidden" value="@item.Id" />
                <input class="addProductToBasket" type="submit" value="Add to basket" />
            }
        }
        </td>
    </tr>
}

</table>
